<?php
defined ( 'BASEPATH' ) or exit ( 'No direct script access allowed' );
class Pickup_model extends CI_Model {
	public function __construct() {
		parent::__construct ();
	}
	/*
	 * 记录取货信息
	 */
	public function create($pickup){
		$this->db->insert('t_pickup', $pickup);
		return $this->db->insert_id();
	}
	/*
	 * 根据用户ID，类型和取餐日期得到取餐信息
	 */
	public function count_by_user_type_date($userid,$type,$date) {
		$this->db->where('userid',$userid);
		$this->db->where('type',$type);
		$this->db->where("DATE_FORMAT(pickup_time,'%Y-%m-%d')",$date);
		$num = $this->db->count_all_results('t_pickup');
		return $num;
	}
}